package com.it;

import com.it.bean.R;
import com.it.pojo.vo.plate.PlateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("plate")
@CrossOrigin
@Api(value = "v2", tags = "板块相关接口")

public class PlateController {


    @Resource
    private PlateService plateService;

    @ApiOperation(value = "查询所有板块", notes = "查询所有板块")
    @GetMapping("list")
    public R<List<PlateVO>> list() {
        List<PlateVO> plateVOS = plateService.listPlates();
        return R.success("成功", plateVOS);

    }

    @ApiOperation(value = "查询所有板块&&板块对应的文章数量", notes = "查询所有板块&&板块对应的文章数量")

    @GetMapping("")
    public R<?> listPlates() {
        List<PlateVO> list = plateService.list();
        return R.success("成功", list);
    }


}
